import {
  createRouter,
  createWebHashHistory,
  type RouteRecordRaw,
} from "vue-router";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "Home",
    component: () => import("@/views/home.vue"),
    meta: {
      title: "首页",
    },
    children: [],
  },
  {
    path: "/news",
    name: "News",
    component: () => import("@/views/info/index.vue"),
    meta: {
      title: "新闻",
    },
    children: [],
  },
  {
    path: "/info",
    name: "Info",
    component: () => import("@/views/info/items.vue"),
    meta: {
      title: "详情",
    },
    children: [],
  },
  {
    path: "/newsdetail",
    name: "newsdetail",
    component: () => import("@/views/info/newsdetail.vue"),
    meta: {
      title: "详情",
    },
    children: [],
  },
  {
    path: "/admindao",
    name: "admindao",
    component: () => import("@/views/admin/admindao.vue"),
    meta: {
      title: "管理员导航",
    },
    children: [{
      path: "/newsfabu",
      name: "newsfabu",
      component: () => import("@/views/admin/newsfabu.vue"),
      meta: {
        title: "新闻发布",
      },
    },
    {
      path: "/adminnews",
      name: "adminnews",
      component: () => import("@/views/admin/adminnews.vue"),
      meta: {
        title: "新闻管理",
      },
    },
    {
      path: "/adminevent",
      name: "adminevent",
      component: () => import("@/views/admin/adminevent.vue"),
      meta: {
        title: "活动预告",
      },
    },
    {
      path: "/adminacad",
      name: "adminacad",
      component: () => import("@/views/admin/adminacad.vue"),
      meta: {
        title: "学术交流",
      },
    },
    {
      path: "/adminnotice",
      name: "adminnotice",
      component: () => import("@/views/admin/adminnotice.vue"),
      meta: {
        title: "工作通知",
      },
    },
    ],
  },

  {
    path: "/daohang",
    name: "daohang",
    component: () => import("@/views/components/daohang.vue"),
    meta: {
      title: "导航",
    },
    children : [
      {
        path: "/allnews",
        name: "allnews",
        component: () => import("@/views/info/allnews.vue"),
        meta: {
          title: "新闻",
        },
      },
      {
        path: "/allevents",
        name: "allevents",
        component: () => import("@/views/info/allevents.vue"),
        meta: {
          title: "活动",
        },
      },
      {
        path: "/allacademic",
        name: "allacademic",
        component: () => import("@/views/info/allacademic.vue"),
        meta: {
          title: "学术",
        },
      },
      {
        path: "/allnotication",
        name: "allnotication",
        component: () => import("@/views/info/allnotication.vue"),
        meta: {
          title: "学术",
        },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
